﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MMS
{
    public partial class FormRentMaterial : Form
    {
        public FormRentMaterial()
        {
            InitializeComponent();
            ChangeLookupTextBoxSizeToMatchListView();
        }

        private void splitContainerControl1_SplitterPositionChanged(object sender, EventArgs e)
        {
            ChangeLookupTextBoxSizeToMatchListView();
        }

        public void ChangeLookupTextBoxSizeToMatchListView()
        {
            //lsvMaterial_Name.Width = lsvMaterial.Width - lsvMaterial_Id.Width;
            lsvMaterial.AutoResizeColumn(1, ColumnHeaderAutoResizeStyle.HeaderSize);
            int idColWidth = 0;
            int nameColWidth = 0;
            idColWidth = lsvMaterial_Id.Width;
            nameColWidth = lsvMaterial_Name.Width;
            txtMaterialId.Size = new Size(idColWidth, 20);
            txtMaterialName.Location = new Point(idColWidth, 22);
            txtMaterialName.Size = new Size(nameColWidth - 20, 20);
            btnMaterialLookup.Location = 
                new Point(txtMaterialId.Size.Width + txtMaterialName.Size.Width, 22);

        }

     
    }
}
